# 文件md5

import hashlib


# 文件md5
def md5File(path=False):
    if not path:
        return False
    file_object = open(path, 'rb')
    file_content = file_object.read()
    file_object.close()
    file_md5 = hashlib.md5(file_content)
    return file_md5.hexdigest()


# 字符串md5
def md5(string=False):
    if not string:
        return False
    return hashlib.md5(string)
